package com.ifeng.shopping.util;

import android.content.Context;
import android.content.SharedPreferences;

public class SharePreStore {
	private static final String FIRST_START=  "first_start";
	private static final String G_GOLDEGG_DAY=  "g_goldegg_day";
	private static final String STRUCT_INFO=  "struct_info";  
	private static final String NAME=  "name";  
	private static final String PASSWORD=  "password";  
	private static final String HOLDPASSWORD=  "holdpassword"; 
	
	private static final String WIDTH_REAL=  "width_real";  
	private static final String HEIGHT_REAL=  "height_real"; 
	private static final String SERVER_URL=  "server_url"; 
	
	
	public static void saveFirstStart(Context context,boolean firstStart){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putBoolean(FIRST_START, firstStart).commit();
	  }
	  
	  public static boolean isFirstStart(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getBoolean(FIRST_START, true);
	  }
	  
	  public static void saveGGoagEggDay(Context context,String gGoldEggDay){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putString(G_GOLDEGG_DAY, gGoldEggDay).commit();
	  }
	  
	  public static String getGGoagEggDay(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getString(G_GOLDEGG_DAY, "");
	  }
	  public static void saveStruct(Context context,String struct){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putString(STRUCT_INFO, struct).commit();
	  }
	  
	  public static String getStruct(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getString(STRUCT_INFO,null);
	  }
	  public static void saveName(Context context,String name){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putString(NAME, name).commit();
	  }
	  
	  public static String getName(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getString(NAME, "");
	  }
	  public static void savePassword(Context context,String password){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putString(PASSWORD, password).commit();
	  }
	  
	  public static String getPassword(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getString(PASSWORD, "");
	  }
	  public static void saveHoldPassword(Context context,boolean holdPassword){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putBoolean(HOLDPASSWORD, holdPassword).commit();
	  }
	  
	  public static boolean isHoldPassword(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getBoolean(HOLDPASSWORD, true);
	  }
	  public static void saveWidthReal(Context context,int width){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putInt(WIDTH_REAL, width).commit();
	  }
	  
	  public static int getWidthReal(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getInt(WIDTH_REAL, 0);
	  }
	  public static void saveHeightReal(Context context,int height){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putInt(HEIGHT_REAL, height).commit();
	  }
	  
	  public static int getHeightReal(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getInt(HEIGHT_REAL, 0);
	  }
	  
	  public static String getServerUrl(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getString(SERVER_URL, "");
	  }
	  public static String getServerUrlTwo(Context context){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
		  return sp.getString(SERVER_URL, "");
	  }
	  public static void saveServerUrl(Context context,String serverUrl){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putString(SERVER_URL, serverUrl).commit();
	  }
	  public static void saveServerUrlTwo(Context context,String serverUrl){
		  SharedPreferences sp = 
			  context.getSharedPreferences("UserInfo", 0);
	      sp.edit().putString(SERVER_URL, serverUrl).commit();
	  }
}
